import threading
import time
from datetime import timedelta, date, datetime
import sys

sys.path.append('C:/Users/mtx/Desktop/Internet-worm')
from qiandao.qd import qiandaoya
from qiandao.send_email import sendEmail
import os

mail_host = "smtp.163.com"  # SMTP服务器
mail_user = "mtcode1024@163.com"  # 用户名
mail_pass = "CDDEHUGOTSNVOXQV"  # 授权密码，非登录密码
if __name__ == '__main__':
    while True:
        now = datetime.now().minute
        nowh = datetime.now().hour
        print(' wait ' + str(now) + ' hour ' + str(nowh))

        # send_email2(mail_host, mail_user, mail_pass, '2359971480@qq.com', '小马精心定制签到服务上午款', 'test')
        if now == 0 and nowh == 8:
            sendEmail('小马精心定制签到服务上午款', qiandaoya(True, True), ['2359971480@qq.com'])
            # send_email2(mail_host, mail_user, mail_pass, '2359971480@qq.com', '小马精心定制签到服务上午款', qiandaoya(True, True))
            sendEmail('小马精心定制签到服务上午款', qiandaoya(True, False), ['790696043@qq.com'])
            # send_email2(mail_host, mail_user, mail_pass, '790696043@qq.com', '小马精心定制签到服务上午款', qiandaoya(True, False))
            break

        if now == 0 and nowh == 15:
            sendEmail('小马精心定制签到服务下午款', qiandaoya(False, True), ['2359971480@qq.com'])
            # send_email2(mail_host, mail_user, mail_pass, '2359971480@qq.com', '小马精心定制签到服务下午款', qiandaoya(False, True))
            sendEmail('小马精心定制签到服务下午款', qiandaoya(False, False), ['790696043@qq.com'])
            # send_email2(mail_host, mail_user, mail_pass, '790696043@qq.com', '小马精心定制签到服务下午款', qiandaoya(False, False))
            break
        time.sleep(10)
    #os.system('shutdown /s /t 0')
